package com.qinghe.pro.test;

import org.junit.runner.RunWith;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用于抽象测试类控制
 * 
 * @author longfei
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
@Transactional
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false)
public class AbstractTestCase {

	public static MockHttpServletRequest getDefaultMockedRequest(String bondary) {
		MockHttpServletRequest req = new MockHttpServletRequest();
		req.setCharacterEncoding("text/plain");
		req.setMethod("POST");
		req.setContentType("multipart/form-data; boundary=" + bondary);
		req.addHeader("Content-type", "multipart/form-data");

		return req;
	}

}
